<?php 


//中午分词  class类
function zw_pscws4($w)
{
	// 加入头文件
	// require '/path/to/pscws4.class.php';

	Vendor('Pscws4.pscws4','','.class.php');

	// 建立分词类对像, 参数为字符集, 默认为 gbk, 可在后面调用 set_charset 改变
	$pscws = new PSCWS4('utf8');

	$pscws->set_dict('./Public/dict.utf8.xdb');
	$pscws->set_rule('./ThinkPHP/Library/Vendor/Pscws4/etc/rules.ini');

	$pscws->send_text($w);

	// while ($some = $pscws->get_result())
	// {
	//    foreach ($some as $word)
	//    {
	//       //var_dump($word);
	//    }
	// }
	// return $word;

	$some = $pscws->get_result();
	//var_dump($some);
	return $some;


	//$tops = $pscws->get_tops(3,'n,v');
	//return $tops;

	// var_dump($pscws);

}

/**
*纪录所有系统日志 所有管理员账号操作
*$open_name 操作功能名
*$log_content 操作日志详细记录
*$ip = get_client_ip() 客户端IP
*
*/
function sys_log($open_name,$log_content='')
{
  $data['open_name'] = $open_name;
  $data['log_content'] = $log_content;
  $data['username'] = $_SESSION['username'];
  $data['client_ip'] = get_client_ip();
  $data['access_time'] = time();
  //入库
  M('sys_log')->add($data);
}


/**
*自动把字段 加多少 
*表名$table 字段$field key $id  加多少$num
*/
function auto_num($table,$field,$id,$num)
{
    $sql = 'update '.$table.' set '.$field.'='.$field.'+'.$num. ' where id='.$id;
    $row = M()->execute($sql);
    return $row;

}














 ?>